package com.c8a.msm.service.impl;

import com.c8a.msm.service.MsmService;
import com.c8a.msm.utils.ConstantPropertiesUtils;
import com.c8a.yygh.vo.msm.MsmVo;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @Author C8A
 * @Date 2021-11-03 10:55
 * @Email 1912327276@qq.com
 */

@Service
public class MsmServiceImpl implements MsmService {
    @Override
    public boolean send(String phone, String code) {
        //判断手机号是否为空
        if (StringUtils.isEmpty(phone)) {
            return false;
        } else {
            //调用方法进行短信发送
            ConstantPropertiesUtils.msmStart(phone, code);
            return true;
        }
    }

    @Override
    public boolean send(MsmVo msmVo) {
        if (!StringUtils.isEmpty(msmVo.getPhone())) {
            String code = (String) msmVo.getParam().get("code");
            ConstantPropertiesUtils.msmStart(msmVo.getPhone(), code);
            return true;
        }
        return false;
    }
}